﻿using System;
using System.Collections.Generic;
using System.Text;
using NSynx.FlowEngine.Interfaces;
using System.Diagnostics;

namespace NSynx.Test
{
    public class TestAction : List<IAction>, IExecutionStep, IAction
    {

        #region IExecutionStep Members

        public DateTime StartTime{get;set;}
        public DateTime EndTime{get;set;}
       
        #endregion


        #region IAction Members

        public NSynx.FlowEngine.Enums.Status Whatsup
        {
            get { throw new NotImplementedException(); }
        }

        public string ActionName
        {
            get;
            set;
        }

        public void Execute()
        {
            Debug.WriteLine(String.Format(" I ({0}) called ", ActionName));

            NotifyIamDone();
        }

        public IList<IParam> InputParameters{get;set;}
        public IList<IParam> OutputParameters{get;set;}

        public void Execute(ISource source)
        {
            Execute();
        }

        public void Execute(ISource source, IList<IParam> parameters)
        {
            this.InputParameters = parameters;
            Execute();
        }

        private void NotifyIamDone()
        {
            if (Finished != null)
            {
                Finished();
            }
        }

        public event ExecutionEnd Finished;

        #endregion
    }
}
